using UnityEditor;
using UnityEditor.UI;
using UnityEngine;

[CustomEditor(typeof(ShapeImage), true)]
public class ShapeImageEditor : ImageEditor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        ShapeImage image = (ShapeImage)target;

        SerializedProperty serializedProperty = serializedObject.FindProperty(nameof(image.offset));
        EditorGUILayout.PropertyField(serializedProperty, new GUIContent("角度偏移"));

        serializedProperty = serializedObject.FindProperty(nameof(image.leftTopOffsetRate));
        EditorGUILayout.PropertyField(serializedProperty, new GUIContent("左上角倾斜率"));

        serializedProperty = serializedObject.FindProperty(nameof(image.rightTopOffsetRate));
        EditorGUILayout.PropertyField(serializedProperty, new GUIContent("右上角倾斜率"));

        serializedProperty = serializedObject.FindProperty(nameof(image.leftBottomOffsetRate));
        EditorGUILayout.PropertyField(serializedProperty, new GUIContent("左下角倾斜率"));

        serializedProperty = serializedObject.FindProperty(nameof(image.rightBottomOffsetRate));
        EditorGUILayout.PropertyField(serializedProperty, new GUIContent("右下角倾斜率"));

        serializedObject.ApplyModifiedProperties();
    }

}
